#第一个for循环
print('='*24+'第一个for循环'+'='*24)
list1 = []
for i in range(1,10):
    list2 = []
    for j in range(1,i+1):
        rst = str('{0}*{1}={2:0>2}'.format(i,j,i*j))
        list2.append(rst)
    list1.append(list2)
for x in range(len(list1)):
    for y in range(len(list1[x])):
        print(list1[x][y],end=' ')
    print('')

#第二个for循环
print('='*24+'第二个for循环'+'='*24)
list3 = []
for i in range(1,10):
    list4 = []
    for j in range(i,10):
        rst = str('{0}*{1}={2:0>2}'.format(i,j,i*j))
        list4.append(rst)
    list3.append(list4)
for x in range(len(list3)):
    for y in range(len(list3[x])):
        print(list3[x][y],end=' ')
    print('')

#第三个for循环
print('='*24+'第三个for循环'+'='*24)
list5 = []
for i in range(9,0,-1):
    list6 = []
    for j in range(9,i-1,-1):
        rst = str('{0}*{1}={2:0>2}'.format(i,j,i*j))
        list6.append(rst)
    list5.append(list6)
for x in range(len(list5)):
    for y in range(len(list5[x])):
        print(list5[x][y],end=' ')
    print('')

#第四个for循环
print('='*24+'第四个for循环'+'='*24)
for i in range(1,10):
    for j in range(1,10-i):
        print(end='       ')
    for k in range(i,0,-1):
        #print('%d*%d=%2d' % (k,i,i*k),end=' ')
        print('{0}*{1}={2:0>2}'.format(k,i,i*k),end=' ')
    print('')

#第一个while循环
print('='*24+'第一个while循环'+'='*24)
i=0
j=0
while i<9:
    i+=1
    while j<9:
        j+=1
        #print(j,"x",i,"=",i*j,"\t",end="")
        print('{0}*{1}={2:0>2}'.format(i,j,i*j),end=' ')
        if i==j:
            j=0
            print("")
            break

#第二个while循环
print('='*24+'第二个while循环'+'='*24)
i = 10
j = 10
while i > 1:
    i = i - 1
    while j > 1:
        j = j - 1
        print('{0}*{1}={2:0>2}'.format(i,j,i*j),end=' ')
        if j == i:
            j = 10
            print('')
            break

#第三个while循环
print('='*24+'第三个while循环'+'='*24)
i = 0
j = 10
while i < 9:
    i = i + 1
    while j > 1:
        j = j - 1
        print('{0}*{1}={2:0>2}'.format(i,j,i*j),end=' ')
        if j == i:
            j = 10
            print('')
            break

#第四个while循环
print('='*24+'第四个while循环'+'='*24)
i = 10
j = 0
while i > 1:
    i -= 1
    while j < 9:
        j += 1
        if i > j:
            print(end='       ')
        if i <= j:
            print('{0}*{1}={2:0>2}'.format(i, j, i * j), end=' ')
        if j == 9:
            j = 0
            print('')
            break
